Because of the recent demand for computerized data processing, an increase in capacity is required for media storage devices, such as magnetic disk devices and optical disk devices, which store data. Hence advances in track density and recording density of disk media are progressing.
Such a data storage device has a cache memory, in addition to the disk medium, so that when a write command is received from a host, the write data from the host is stored in the cache memory, and in this stage, write completion is reported to the host. Then later the write data in the cache memory is written to a disk medium.
In this way, by reporting write completion to the host before recording the data to the disk medium, which takes time, the processing time of the write command can be decreased, and processing speed of the entire system can be improved.
On the other hand, when write data of a plurality of write commands from a host is stored in a cache memory, it is effective to secure a ring buffer area in the cache memory, store the write data in the cache memory sequentially, and write the data sequentially to the medium.
FIG. 11 is a diagram depicting an operation of a conventional ring buffer. In FIG. 11, the ring buffer 100 has a size corresponding to n sectors. When a write command is received, data is written from a position of a host address pointer (hereafter called HAP), and new write data overwrote the old write data received in the past.
Data is written to the medium from a position of a disk address pointer (hereafter called DAP). In FIG. 11, cached write data (data which has not yet been written to the medium) is “3” to “n”, and “1” and “2” are data already written to the medium, which are controlled not to be overwritten in the buffer, so that when an error occurs, this data is save data for writing by returning from the sector where the error occurred (as data for return sectors).
For example, if write data has four sectors, n+1, n+2, n+3 and n+4, when a next write command is received from a host, the areas “1” to “4” of the ring buffer 100 are overwritten by the new write data n+1, n+2, n+3 and n+4. Writing data to the medium is progressing at this time, and write data in the areas “3” to “6” in the ring buffer 100 has already been written to the medium, so areas “5” and “6” are saved as return sectors which are not overwritten.
Conventionally, as FIG. 12 shows, the write cache data of the ring buffer 100 is write data not yet written to the medium, and return sectors are already written data, which are used when a write start LBA is returned during retry, and several sectors (2 to 4 sectors) are set for the return sectors.
When the data is being written to a disk, a write error, due to off tracking of the head, may occur some reason. In this case, when a write error is detected, sectors in the servo frame, including the sectors which is detected the error, may be damaged, so a plurality of sectors have been secured as a return area in the ring buffer 100, as shown in FIG. 12.
As FIG. 13 and FIG. 14 show, if a write error is detected in a track B, the head is moved to a position where an LBA (Logical Block Address) is returned for a predetermined number of return sectors (triangle in FIG. 14) within a range from the write error generated LBA (x in FIG. 13 and FIG. 14) to the track B, and a write retry is executed for the LBA, which is returned for a plurality of sectors from the error generated sector E (e.g. U.S. Pat. No. 3,942,483 and Japanese Patent Application Laid-Open No. 2006-252733).
In this way, conventionally if sequential write commands are continuously issued, a predetermined number of sectors of the ring buffer 100 is secured, and medium is written while overwriting old data in the ring buffer 100. When the above mentioned write error occurs, rewrite processing is performed from the LBA returned from an error detected timing for a plurality of servo frames.
Since off track writing normally occurs due to vibration from the outside, a shock sensor is installed in the storage device, and when vibration is detected by the shock sensor, influence on the adjacent tracks is prevented, such as preventing the generation of a write gate.
Because of the recent demand for downsizing devices, such a disk storage device is also installed in a compact server and mobile equipment (e.g. notebook personal computer and portable AV (Audio/Visual) equipment). Also as recording density increases, track pitch is becoming smaller. And this increases off tracking of the head.
If timing to stop the write gate generation delays when a shock is detected, writing may be executed on adjacent tracks. For example, when the detection of vibration delays due to internal vibration that the actuator (suspension) which supports the head is vibrated by the change of wind pressure generated by disk rotation or the detection sensitivity of the shock sensor during writing, timing to stop the generation of a write gate may delay.
In the case of a prior art, data does not remain in the buffer, except for a plurality of sectors for return, due to the limitation of buffer capacity, so one or more tracks of data cannot be written back, and a write error to adjacent tracks may be generated.